{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "figured-representation",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3.13.2 | packaged by conda-forge | (main, Feb 17 2025, 14:10:22) [GCC 13.3.0]\n",
      "2025.09.1\n"
     ]
    }
   ],
   "source": [
    "import sys\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "from rdkit import rdBase, Chem, DataStructs\n",
    "from rdkit.Chem import AllChem, Draw, Descriptors, PandasTools, rdMolDescriptors\n",
    "from rdkit.Chem import MACCSkeys, rdFingerprintGenerator\n",
    "from rdkit.Chem.AtomPairs import Pairs\n",
    "from mapchiral.mapchiral import encode, jaccard_similarity\n",
    "from rdkit.Chem import EnumerateStereoisomers\n",
    "PandasTools.RenderImagesInAllDataFrames(True)\n",
    "from rdkit.Chem.Draw import IPythonConsole\n",
    "from rdkit.Chem.Draw import rdDepictor\n",
    "\n",
    "rdDepictor.SetPreferCoordGen(True)\n",
    "IPythonConsole.molSize = (350,300)\n",
    "IPythonConsole.ipython_useSVG=True\n",
    "IPythonConsole.drawOptions.addStereoAnnotation = True\n",
    "\n",
    "print(sys.version)\n",
    "print(rdBase.rdkitVersion)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "double-tender",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Define SMILES for R- and S-thalidomide\n",
    "smiles_R = \"O=C(N1)CC[C@@H](N2C(C3=CC=CC=C3C2=O)=O)C1=O\"\n",
    "smiles_S = \"O=C(N1)CC[C@H](N2C(C3=CC=CC=C3C2=O)=O)C1=O\"\n",
    "\n",
    "mol_R = Chem.MolFromSmiles(smiles_R)\n",
    "mol_S = Chem.MolFromSmiles(smiles_S)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "22746af0-b7b5-4a72-b008-8041030c593c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:rdkit=\"http://www.rdkit.org/xml\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\" baseProfile=\"full\" xml:space=\"preserve\" width=\"600px\" height=\"250px\" viewBox=\"0 0 600 250\">\n",
       "<!-- END OF HEADER -->\n",
       "<rect style=\"opacity:1.0;fill:#FFFFFF;stroke:none\" width=\"300.0\" height=\"250.0\" x=\"0.0\" y=\"0.0\"> </rect>\n",
       "<path class=\"bond-0 atom-0 atom-1\" d=\"M 269.6,56.2 L 256.0,64.0\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-0 atom-0 atom-1\" d=\"M 256.0,64.0 L 242.5,71.7\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-0 atom-0 atom-1\" d=\"M 266.6,51.0 L 253.1,58.8\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-0 atom-0 atom-1\" d=\"M 253.1,58.8 L 239.5,66.5\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-1 atom-1 atom-2\" d=\"M 242.5,68.3 L 242.4,83.3\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-1 atom-1 atom-2\" d=\"M 242.4,83.3 L 242.4,98.4\" style=\"fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-2 atom-1 atom-3\" d=\"M 242.5,68.3 L 208.0,48.1\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-3 atom-3 atom-4\" d=\"M 208.0,48.1 L 173.3,68.0\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-4 atom-4 atom-5\" d=\"M 173.3,68.0 L 173.1,107.9\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-5 atom-5 atom-6\" d=\"M 169.7,109.4 L 170.1,110.1\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-5 atom-5 atom-6\" d=\"M 166.3,110.8 L 167.1,112.3\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-5 atom-5 atom-6\" d=\"M 162.9,112.3 L 164.2,114.5\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-5 atom-5 atom-6\" d=\"M 159.5,113.8 L 161.2,116.7\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-5 atom-5 atom-6\" d=\"M 156.1,115.2 L 158.2,118.9\" style=\"fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:1.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-5 atom-5 atom-6\" d=\"M 152.7,116.7 L 155.2,121.1\" style=\"fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:1.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-5 atom-5 atom-6\" d=\"M 149.2,118.1 L 152.2,123.3\" style=\"fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:1.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-6 atom-6 atom-7\" d=\"M 130.7,124.3 L 116.3,117.8\" style=\"fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-6 atom-6 atom-7\" d=\"M 116.3,117.8 L 102.0,111.4\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-7 atom-7 atom-8\" d=\"M 102.0,111.4 L 75.1,140.9\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-8 atom-8 atom-9\" d=\"M 75.1,140.9 L 35.1,140.8\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-8 atom-8 atom-9\" d=\"M 71.6,146.9 L 38.6,146.8\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-9 atom-9 atom-10\" d=\"M 35.1,140.8 L 15.0,175.3\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-10 atom-10 atom-11\" d=\"M 15.0,175.3 L 34.8,210.0\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-10 atom-10 atom-11\" d=\"M 21.9,175.3 L 38.3,204.0\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-11 atom-11 atom-12\" d=\"M 34.8,210.0 L 74.8,210.1\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-12 atom-12 atom-13\" d=\"M 74.8,210.1 L 94.9,175.6\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-12 atom-12 atom-13\" d=\"M 71.4,204.1 L 88.0,175.6\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-13 atom-13 atom-14\" d=\"M 94.9,175.6 L 134.1,167.5\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-14 atom-14 atom-15\" d=\"M 130.4,168.2 L 141.5,178.3\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-14 atom-14 atom-15\" d=\"M 141.5,178.3 L 152.5,188.3\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-14 atom-14 atom-15\" d=\"M 134.5,163.8 L 145.5,173.8\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-14 atom-14 atom-15\" d=\"M 145.5,173.8 L 156.5,183.9\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-15 atom-7 atom-16\" d=\"M 105.4,112.9 L 102.1,97.3\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-15 atom-7 atom-16\" d=\"M 102.1,97.3 L 98.9,81.8\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-15 atom-7 atom-16\" d=\"M 99.5,114.1 L 96.2,98.5\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-15 atom-7 atom-16\" d=\"M 96.2,98.5 L 93.0,83.0\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-16 atom-5 atom-17\" d=\"M 173.1,107.9 L 207.6,128.1\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-17 atom-17 atom-18\" d=\"M 204.6,126.3 L 204.6,142.2\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-17 atom-17 atom-18\" d=\"M 204.6,142.2 L 204.5,158.1\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-17 atom-17 atom-18\" d=\"M 210.6,126.3 L 210.6,142.2\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-17 atom-17 atom-18\" d=\"M 210.6,142.2 L 210.5,158.1\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-18 atom-17 atom-2\" d=\"M 207.6,128.1 L 221.1,120.4\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-18 atom-17 atom-2\" d=\"M 221.1,120.4 L 234.6,112.7\" style=\"fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-19 atom-14 atom-6\" d=\"M 134.1,167.5 L 135.7,152.5\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-19 atom-14 atom-6\" d=\"M 135.7,152.5 L 137.3,137.6\" style=\"fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-20 atom-13 atom-8\" d=\"M 94.9,175.6 L 75.1,140.9\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path d=\"M 242.5,69.0 L 242.5,68.3 L 240.8,67.3\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 209.7,49.1 L 208.0,48.1 L 206.3,49.1\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 175.0,67.0 L 173.3,68.0 L 173.3,70.0\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 173.1,105.9 L 173.1,107.9 L 174.8,108.9\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 102.7,111.7 L 102.0,111.4 L 100.6,112.8\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 37.1,140.8 L 35.1,140.8 L 34.1,142.5\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 16.0,173.5 L 15.0,175.3 L 16.0,177.0\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 33.8,208.2 L 34.8,210.0 L 36.8,210.0\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 72.8,210.1 L 74.8,210.1 L 75.8,208.4\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 132.1,167.9 L 134.1,167.5 L 134.1,166.7\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 205.9,127.1 L 207.6,128.1 L 208.3,127.7\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path class=\"atom-0\" d=\"M 269.4 48.5 Q 269.4 44.4, 271.4 42.1 Q 273.4 39.9, 277.2 39.9 Q 281.0 39.9, 283.0 42.1 Q 285.0 44.4, 285.0 48.5 Q 285.0 52.6, 283.0 55.0 Q 280.9 57.3, 277.2 57.3 Q 273.5 57.3, 271.4 55.0 Q 269.4 52.6, 269.4 48.5 M 277.2 55.4 Q 279.8 55.4, 281.2 53.6 Q 282.6 51.9, 282.6 48.5 Q 282.6 45.2, 281.2 43.5 Q 279.8 41.8, 277.2 41.8 Q 274.6 41.8, 273.2 43.5 Q 271.8 45.1, 271.8 48.5 Q 271.8 51.9, 273.2 53.6 Q 274.6 55.4, 277.2 55.4 \" fill=\"#FF0000\"/>\n",
       "<path class=\"atom-2\" d=\"M 238.6 99.7 L 244.1 108.7 Q 244.7 109.6, 245.6 111.2 Q 246.5 112.8, 246.5 112.9 L 246.5 99.7 L 248.8 99.7 L 248.8 116.7 L 246.4 116.7 L 240.5 106.9 Q 239.8 105.7, 239.0 104.4 Q 238.3 103.1, 238.1 102.7 L 238.1 116.7 L 235.9 116.7 L 235.9 99.7 L 238.6 99.7 \" fill=\"#0000FF\"/>\n",
       "<path class=\"atom-2\" d=\"M 252.1 99.7 L 254.4 99.7 L 254.4 107.0 L 263.1 107.0 L 263.1 99.7 L 265.4 99.7 L 265.4 116.7 L 263.1 116.7 L 263.1 108.9 L 254.4 108.9 L 254.4 116.7 L 252.1 116.7 L 252.1 99.7 \" fill=\"#0000FF\"/>\n",
       "<path class=\"atom-6\" d=\"M 134.7 119.3 L 140.2 128.3 Q 140.8 129.2, 141.7 130.8 Q 142.6 132.4, 142.6 132.5 L 142.6 119.3 L 144.9 119.3 L 144.9 136.3 L 142.5 136.3 L 136.6 126.4 Q 135.9 125.3, 135.1 123.9 Q 134.4 122.6, 134.2 122.2 L 134.2 136.3 L 132.0 136.3 L 132.0 119.3 L 134.7 119.3 \" fill=\"#0000FF\"/>\n",
       "<path class=\"atom-15\" d=\"M 155.8 194.4 Q 155.8 190.3, 157.9 188.1 Q 159.9 185.8, 163.6 185.8 Q 167.4 185.8, 169.4 188.1 Q 171.4 190.3, 171.4 194.4 Q 171.4 198.5, 169.4 200.9 Q 167.4 203.2, 163.6 203.2 Q 159.9 203.2, 157.9 200.9 Q 155.8 198.6, 155.8 194.4 M 163.6 201.3 Q 166.2 201.3, 167.6 199.6 Q 169.0 197.8, 169.0 194.4 Q 169.0 191.1, 167.6 189.4 Q 166.2 187.7, 163.6 187.7 Q 161.1 187.7, 159.6 189.4 Q 158.2 191.1, 158.2 194.4 Q 158.2 197.8, 159.6 199.6 Q 161.1 201.3, 163.6 201.3 \" fill=\"#FF0000\"/>\n",
       "<path class=\"atom-16\" d=\"M 86.0 72.3 Q 86.0 68.2, 88.1 65.9 Q 90.1 63.6, 93.8 63.6 Q 97.6 63.6, 99.6 65.9 Q 101.6 68.2, 101.6 72.3 Q 101.6 76.4, 99.6 78.7 Q 97.6 81.1, 93.8 81.1 Q 90.1 81.1, 88.1 78.7 Q 86.0 76.4, 86.0 72.3 M 93.8 79.2 Q 96.4 79.2, 97.8 77.4 Q 99.2 75.7, 99.2 72.3 Q 99.2 68.9, 97.8 67.3 Q 96.4 65.6, 93.8 65.6 Q 91.2 65.6, 89.8 67.2 Q 88.4 68.9, 88.4 72.3 Q 88.4 75.7, 89.8 77.4 Q 91.2 79.2, 93.8 79.2 \" fill=\"#FF0000\"/>\n",
       "<path class=\"atom-18\" d=\"M 199.7 168.1 Q 199.7 164.0, 201.7 161.7 Q 203.7 159.4, 207.5 159.4 Q 211.2 159.4, 213.2 161.7 Q 215.3 164.0, 215.3 168.1 Q 215.3 172.2, 213.2 174.6 Q 211.2 176.9, 207.5 176.9 Q 203.7 176.9, 201.7 174.6 Q 199.7 172.2, 199.7 168.1 M 207.5 175.0 Q 210.0 175.0, 211.4 173.2 Q 212.9 171.5, 212.9 168.1 Q 212.9 164.7, 211.4 163.1 Q 210.0 161.4, 207.5 161.4 Q 204.9 161.4, 203.5 163.0 Q 202.1 164.7, 202.1 168.1 Q 202.1 171.5, 203.5 173.2 Q 204.9 175.0, 207.5 175.0 \" fill=\"#FF0000\"/>\n",
       "<path class=\"CIP_Code\" d=\"M 149.6 99.2 Q 149.6 97.5, 150.1 96.1 Q 150.6 94.7, 151.6 93.1 L 152.3 93.5 Q 151.5 95.0, 151.1 96.3 Q 150.7 97.6, 150.7 99.2 Q 150.7 100.8, 151.1 102.1 Q 151.5 103.4, 152.3 104.8 L 151.6 105.3 Q 150.6 103.8, 150.1 102.3 Q 149.6 100.9, 149.6 99.2 \" fill=\"#000000\"/>\n",
       "<path class=\"CIP_Code\" d=\"M 157.5 102.6 L 155.5 99.1 L 155.4 99.1 L 154.1 99.1 L 154.1 102.6 L 152.9 102.6 L 152.9 94.1 L 155.4 94.1 Q 156.9 94.1, 157.6 94.8 Q 158.4 95.4, 158.4 96.6 Q 158.4 97.5, 157.9 98.1 Q 157.5 98.7, 156.6 99.0 L 158.8 102.6 L 157.5 102.6 M 154.1 98.2 L 155.4 98.2 Q 156.3 98.2, 156.7 97.8 Q 157.2 97.4, 157.2 96.6 Q 157.2 95.9, 156.7 95.5 Q 156.3 95.1, 155.4 95.1 L 154.1 95.1 L 154.1 98.2 \" fill=\"#000000\"/>\n",
       "<path class=\"CIP_Code\" d=\"M 162.1 99.2 Q 162.1 100.9, 161.6 102.3 Q 161.1 103.8, 160.1 105.3 L 159.4 104.8 Q 160.2 103.4, 160.6 102.1 Q 161.0 100.8, 161.0 99.2 Q 161.0 97.6, 160.6 96.3 Q 160.2 95.0, 159.4 93.5 L 160.1 93.1 Q 161.1 94.7, 161.6 96.1 Q 162.1 97.5, 162.1 99.2 \" fill=\"#000000\"/>\n",
       "<path class=\"bond-0 atom-0 atom-1\" d=\"M 569.6,56.2 L 556.0,64.0\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-0 atom-0 atom-1\" d=\"M 556.0,64.0 L 542.5,71.7\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-0 atom-0 atom-1\" d=\"M 566.6,51.0 L 553.1,58.8\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-0 atom-0 atom-1\" d=\"M 553.1,58.8 L 539.5,66.5\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-1 atom-1 atom-2\" d=\"M 542.5,68.3 L 542.4,83.3\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-1 atom-1 atom-2\" d=\"M 542.4,83.3 L 542.4,98.4\" style=\"fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-2 atom-1 atom-3\" d=\"M 542.5,68.3 L 508.0,48.1\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-3 atom-3 atom-4\" d=\"M 508.0,48.1 L 473.3,68.0\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-4 atom-4 atom-5\" d=\"M 473.3,68.0 L 473.1,107.9\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-5 atom-5 atom-6\" d=\"M 473.1,107.9 L 461.0,116.6 L 459.6,114.0 Z\" style=\"fill:#000000;fill-rule:evenodd;fill-opacity:1;stroke:#000000;stroke-width:0.5px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path class=\"bond-5 atom-5 atom-6\" d=\"M 461.0,116.6 L 446.0,120.0 L 449.0,125.2 Z\" style=\"fill:#0000FF;fill-rule:evenodd;fill-opacity:1;stroke:#0000FF;stroke-width:0.5px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path class=\"bond-5 atom-5 atom-6\" d=\"M 461.0,116.6 L 459.6,114.0 L 446.0,120.0 Z\" style=\"fill:#0000FF;fill-rule:evenodd;fill-opacity:1;stroke:#0000FF;stroke-width:0.5px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path class=\"bond-6 atom-6 atom-7\" d=\"M 430.7,124.3 L 416.3,117.8\" style=\"fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-6 atom-6 atom-7\" d=\"M 416.3,117.8 L 402.0,111.4\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-7 atom-7 atom-8\" d=\"M 402.0,111.4 L 375.1,140.9\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-8 atom-8 atom-9\" d=\"M 375.1,140.9 L 335.1,140.8\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-8 atom-8 atom-9\" d=\"M 371.6,146.9 L 338.6,146.8\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-9 atom-9 atom-10\" d=\"M 335.1,140.8 L 315.0,175.3\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-10 atom-10 atom-11\" d=\"M 315.0,175.3 L 334.8,210.0\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-10 atom-10 atom-11\" d=\"M 321.9,175.3 L 338.3,204.0\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-11 atom-11 atom-12\" d=\"M 334.8,210.0 L 374.8,210.1\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-12 atom-12 atom-13\" d=\"M 374.8,210.1 L 394.9,175.6\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-12 atom-12 atom-13\" d=\"M 371.4,204.1 L 388.0,175.6\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-13 atom-13 atom-14\" d=\"M 394.9,175.6 L 434.1,167.5\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-14 atom-14 atom-15\" d=\"M 430.4,168.2 L 441.5,178.3\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-14 atom-14 atom-15\" d=\"M 441.5,178.3 L 452.5,188.3\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-14 atom-14 atom-15\" d=\"M 434.5,163.8 L 445.5,173.8\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-14 atom-14 atom-15\" d=\"M 445.5,173.8 L 456.5,183.9\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-15 atom-7 atom-16\" d=\"M 405.4,112.9 L 402.1,97.3\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-15 atom-7 atom-16\" d=\"M 402.1,97.3 L 398.9,81.8\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-15 atom-7 atom-16\" d=\"M 399.5,114.1 L 396.2,98.5\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-15 atom-7 atom-16\" d=\"M 396.2,98.5 L 393.0,83.0\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-16 atom-5 atom-17\" d=\"M 473.1,107.9 L 507.6,128.1\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-17 atom-17 atom-18\" d=\"M 504.6,126.3 L 504.6,142.2\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-17 atom-17 atom-18\" d=\"M 504.6,142.2 L 504.5,158.1\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-17 atom-17 atom-18\" d=\"M 510.6,126.3 L 510.6,142.2\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-17 atom-17 atom-18\" d=\"M 510.6,142.2 L 510.5,158.1\" style=\"fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-18 atom-17 atom-2\" d=\"M 507.6,128.1 L 521.1,120.4\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-18 atom-17 atom-2\" d=\"M 521.1,120.4 L 534.6,112.7\" style=\"fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-19 atom-14 atom-6\" d=\"M 434.1,167.5 L 435.7,152.5\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-19 atom-14 atom-6\" d=\"M 435.7,152.5 L 437.3,137.6\" style=\"fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path class=\"bond-20 atom-13 atom-8\" d=\"M 394.9,175.6 L 375.1,140.9\" style=\"fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\"/>\n",
       "<path d=\"M 542.5,69.0 L 542.5,68.3 L 540.8,67.3\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 509.7,49.1 L 508.0,48.1 L 506.3,49.1\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 475.0,67.0 L 473.3,68.0 L 473.3,70.0\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 473.1,105.9 L 473.1,107.9 L 474.8,108.9\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 402.7,111.7 L 402.0,111.4 L 400.6,112.8\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 337.1,140.8 L 335.1,140.8 L 334.1,142.5\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 316.0,173.5 L 315.0,175.3 L 316.0,177.0\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 333.8,208.2 L 334.8,210.0 L 336.8,210.0\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 372.8,210.1 L 374.8,210.1 L 375.8,208.4\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 432.1,167.9 L 434.1,167.5 L 434.1,166.7\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path d=\"M 505.9,127.1 L 507.6,128.1 L 508.3,127.7\" style=\"fill:none;stroke:#000000;stroke-width:2.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;\"/>\n",
       "<path class=\"atom-0\" d=\"M 569.4 48.5 Q 569.4 44.4, 571.4 42.1 Q 573.4 39.9, 577.2 39.9 Q 581.0 39.9, 583.0 42.1 Q 585.0 44.4, 585.0 48.5 Q 585.0 52.6, 583.0 55.0 Q 580.9 57.3, 577.2 57.3 Q 573.5 57.3, 571.4 55.0 Q 569.4 52.6, 569.4 48.5 M 577.2 55.4 Q 579.8 55.4, 581.2 53.6 Q 582.6 51.9, 582.6 48.5 Q 582.6 45.2, 581.2 43.5 Q 579.8 41.8, 577.2 41.8 Q 574.6 41.8, 573.2 43.5 Q 571.8 45.1, 571.8 48.5 Q 571.8 51.9, 573.2 53.6 Q 574.6 55.4, 577.2 55.4 \" fill=\"#FF0000\"/>\n",
       "<path class=\"atom-2\" d=\"M 538.6 99.7 L 544.1 108.7 Q 544.7 109.6, 545.6 111.2 Q 546.5 112.8, 546.5 112.9 L 546.5 99.7 L 548.8 99.7 L 548.8 116.7 L 546.4 116.7 L 540.5 106.9 Q 539.8 105.7, 539.0 104.4 Q 538.3 103.1, 538.1 102.7 L 538.1 116.7 L 535.9 116.7 L 535.9 99.7 L 538.6 99.7 \" fill=\"#0000FF\"/>\n",
       "<path class=\"atom-2\" d=\"M 552.1 99.7 L 554.4 99.7 L 554.4 107.0 L 563.1 107.0 L 563.1 99.7 L 565.4 99.7 L 565.4 116.7 L 563.1 116.7 L 563.1 108.9 L 554.4 108.9 L 554.4 116.7 L 552.1 116.7 L 552.1 99.7 \" fill=\"#0000FF\"/>\n",
       "<path class=\"atom-6\" d=\"M 434.7 119.3 L 440.2 128.3 Q 440.8 129.2, 441.7 130.8 Q 442.6 132.4, 442.6 132.5 L 442.6 119.3 L 444.9 119.3 L 444.9 136.3 L 442.5 136.3 L 436.6 126.4 Q 435.9 125.3, 435.1 123.9 Q 434.4 122.6, 434.2 122.2 L 434.2 136.3 L 432.0 136.3 L 432.0 119.3 L 434.7 119.3 \" fill=\"#0000FF\"/>\n",
       "<path class=\"atom-15\" d=\"M 455.8 194.4 Q 455.8 190.3, 457.9 188.1 Q 459.9 185.8, 463.6 185.8 Q 467.4 185.8, 469.4 188.1 Q 471.4 190.3, 471.4 194.4 Q 471.4 198.5, 469.4 200.9 Q 467.4 203.2, 463.6 203.2 Q 459.9 203.2, 457.9 200.9 Q 455.8 198.6, 455.8 194.4 M 463.6 201.3 Q 466.2 201.3, 467.6 199.6 Q 469.0 197.8, 469.0 194.4 Q 469.0 191.1, 467.6 189.4 Q 466.2 187.7, 463.6 187.7 Q 461.1 187.7, 459.6 189.4 Q 458.2 191.1, 458.2 194.4 Q 458.2 197.8, 459.6 199.6 Q 461.1 201.3, 463.6 201.3 \" fill=\"#FF0000\"/>\n",
       "<path class=\"atom-16\" d=\"M 386.0 72.3 Q 386.0 68.2, 388.1 65.9 Q 390.1 63.6, 393.8 63.6 Q 397.6 63.6, 399.6 65.9 Q 401.6 68.2, 401.6 72.3 Q 401.6 76.4, 399.6 78.7 Q 397.6 81.1, 393.8 81.1 Q 390.1 81.1, 388.1 78.7 Q 386.0 76.4, 386.0 72.3 M 393.8 79.2 Q 396.4 79.2, 397.8 77.4 Q 399.2 75.7, 399.2 72.3 Q 399.2 68.9, 397.8 67.3 Q 396.4 65.6, 393.8 65.6 Q 391.2 65.6, 389.8 67.2 Q 388.4 68.9, 388.4 72.3 Q 388.4 75.7, 389.8 77.4 Q 391.2 79.2, 393.8 79.2 \" fill=\"#FF0000\"/>\n",
       "<path class=\"atom-18\" d=\"M 499.7 168.1 Q 499.7 164.0, 501.7 161.7 Q 503.7 159.4, 507.5 159.4 Q 511.2 159.4, 513.2 161.7 Q 515.3 164.0, 515.3 168.1 Q 515.3 172.2, 513.2 174.6 Q 511.2 176.9, 507.5 176.9 Q 503.7 176.9, 501.7 174.6 Q 499.7 172.2, 499.7 168.1 M 507.5 175.0 Q 510.0 175.0, 511.4 173.2 Q 512.9 171.5, 512.9 168.1 Q 512.9 164.7, 511.4 163.1 Q 510.0 161.4, 507.5 161.4 Q 504.9 161.4, 503.5 163.0 Q 502.1 164.7, 502.1 168.1 Q 502.1 171.5, 503.5 173.2 Q 504.9 175.0, 507.5 175.0 \" fill=\"#FF0000\"/>\n",
       "<path class=\"CIP_Code\" d=\"M 449.7 99.2 Q 449.7 97.5, 450.2 96.1 Q 450.7 94.7, 451.7 93.1 L 452.3 93.5 Q 451.6 95.0, 451.2 96.3 Q 450.8 97.6, 450.8 99.2 Q 450.8 100.8, 451.2 102.1 Q 451.6 103.4, 452.3 104.8 L 451.7 105.3 Q 450.7 103.8, 450.2 102.3 Q 449.7 100.9, 449.7 99.2 \" fill=\"#000000\"/>\n",
       "<path class=\"CIP_Code\" d=\"M 453.3 101.3 Q 453.4 101.3, 453.8 101.5 Q 454.2 101.7, 454.6 101.8 Q 455.1 101.9, 455.5 101.9 Q 456.3 101.9, 456.8 101.5 Q 457.3 101.1, 457.3 100.4 Q 457.3 99.9, 457.0 99.6 Q 456.8 99.4, 456.4 99.2 Q 456.1 99.1, 455.5 98.9 Q 454.7 98.6, 454.3 98.4 Q 453.8 98.2, 453.5 97.8 Q 453.2 97.3, 453.2 96.5 Q 453.2 95.5, 453.9 94.8 Q 454.6 94.1, 456.1 94.1 Q 457.0 94.1, 458.2 94.6 L 457.9 95.5 Q 456.9 95.1, 456.1 95.1 Q 455.3 95.1, 454.8 95.5 Q 454.4 95.8, 454.4 96.4 Q 454.4 96.8, 454.6 97.1 Q 454.8 97.4, 455.2 97.6 Q 455.5 97.7, 456.1 97.9 Q 456.9 98.1, 457.3 98.4 Q 457.8 98.6, 458.1 99.1 Q 458.4 99.6, 458.4 100.4 Q 458.4 101.6, 457.6 102.2 Q 456.9 102.8, 455.6 102.8 Q 454.8 102.8, 454.2 102.7 Q 453.7 102.5, 453.0 102.2 L 453.3 101.3 \" fill=\"#000000\"/>\n",
       "<path class=\"CIP_Code\" d=\"M 462.0 99.2 Q 462.0 100.9, 461.5 102.3 Q 461.0 103.8, 460.0 105.3 L 459.4 104.8 Q 460.1 103.4, 460.5 102.1 Q 460.9 100.8, 460.9 99.2 Q 460.9 97.6, 460.5 96.3 Q 460.1 95.0, 459.4 93.5 L 460.0 93.1 Q 461.0 94.7, 461.5 96.1 Q 462.0 97.5, 462.0 99.2 \" fill=\"#000000\"/>\n",
       "</svg>"
      ],
      "text/plain": [
       "<IPython.core.display.SVG object>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Draw.MolsToGridImage([mol_R, mol_S], molsPerRow=2, subImgSize=(300, 250))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "occasional-missile",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "# Generate Morgan fingerprints with different radii\n",
    "def get_morgan_fp(mol, r):\n",
    "    mfpgen = rdFingerprintGenerator.GetMorganGenerator(radius=r, fpSize=2048, includeChirality=True)\n",
    "    return mfpgen.GetFingerprint(mol)\n",
    "\n",
    "# Generate MapChiral fingerprints with different radii\n",
    "def get_mapchiral_fp(mol, r):\n",
    "    return encode(mol, max_radius=r, n_permutations=2048, mapping=False)\n",
    "\n",
    "# Generate Topological Torsion fingerprint with chirality\n",
    "def get_torsion_fp(mol):\n",
    "    ttgen = rdFingerprintGenerator.GetTopologicalTorsionGenerator(fpSize=2048, includeChirality=True)\n",
    "    return ttgen.GetFingerprint(mol)\n",
    "\n",
    "# Atom Pair fingerprint with chirality\n",
    "def get_atompair_fp(mol):\n",
    "    apgen = rdFingerprintGenerator.GetAtomPairGenerator(fpSize=2048)\n",
    "    return apgen.GetFingerprint(mol)\n",
    "\n",
    "# Other fingerprints\n",
    "def get_other_fps(mol):\n",
    "    fps = {}\n",
    "    fps['RDKit'] = Chem.RDKFingerprint(mol)\n",
    "    fps['MACCS'] = MACCSkeys.GenMACCSKeys(mol)\n",
    "    return fps\n",
    "\n",
    "# Similarity functions\n",
    "def tanimoto(fp1, fp2):\n",
    "    return DataStructs.TanimotoSimilarity(fp1, fp2)\n",
    "def dice(fp1, fp2):\n",
    "    return DataStructs.DiceSimilarity(fp1, fp2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "palestinian-lodge",
   "metadata": {},
   "outputs": [],
   "source": [
    "fps_R1 = get_morgan_fp(mol_R, 1)\n",
    "fps_S1 = get_morgan_fp(mol_S, 1)\n",
    "fps_R2 = get_morgan_fp(mol_R, 2)\n",
    "fps_S2 = get_morgan_fp(mol_S, 2)\n",
    "\n",
    "mapchiral_R1 = get_mapchiral_fp(mol_R, 1)\n",
    "mapchiral_S1 = get_mapchiral_fp(mol_S, 1)\n",
    "mapchiral_R2 = get_mapchiral_fp(mol_R, 2)\n",
    "mapchiral_S2 = get_mapchiral_fp(mol_S, 2)\n",
    "\n",
    "torsion_R = get_torsion_fp(mol_R)\n",
    "torsion_S = get_torsion_fp(mol_S)\n",
    "\n",
    "apfp_R = get_atompair_fp(mol_R)\n",
    "apfp_S = get_atompair_fp(mol_S)\n",
    "\n",
    "other_fps_R = get_other_fps(mol_R)\n",
    "other_fps_S = get_other_fps(mol_S)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "changing-stations",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Similarity between R- and S-thalidomide:\n",
      "Morgan fingerprint (radius 1) similarity: 0.900\n",
      "Morgan fingerprint (radius 2) similarity: 0.714\n",
      "MapChiral fingerprint (radius 1) similarity: 0.745\n",
      "MapChiral fingerprint (radius 2) similarity: 0.879\n",
      "Topological Torsion fingerprint similarity: 0.635\n",
      "Atom Pair fingerprint similarity: 1.000\n",
      "RDKit fingerprint similarity: 1.000\n",
      "MACCS fingerprint similarity: 1.000\n"
     ]
    }
   ],
   "source": [
    "# Compute similarities\n",
    "print(\"Similarity between R- and S-thalidomide:\")\n",
    "\n",
    "print(f\"Morgan fingerprint (radius 1) similarity: {tanimoto(fps_R1, fps_S1):.3f}\")\n",
    "print(f\"Morgan fingerprint (radius 2) similarity: {tanimoto(fps_R2, fps_S2):.3f}\")\n",
    "\n",
    "print(f\"MapChiral fingerprint (radius 1) similarity: {jaccard_similarity(mapchiral_R1, mapchiral_S1):.3f}\")\n",
    "print(f\"MapChiral fingerprint (radius 2) similarity: {jaccard_similarity(mapchiral_R2, mapchiral_S2):.3f}\")\n",
    "\n",
    "print(f\"Topological Torsion fingerprint similarity: {dice(torsion_R, torsion_S):.3f}\")\n",
    "\n",
    "print(f\"Atom Pair fingerprint similarity: {tanimoto(apfp_R, apfp_S):.3f}\")\n",
    "\n",
    "for key in ['RDKit', 'MACCS']:\n",
    "    sim = tanimoto(other_fps_R[key], other_fps_S[key])\n",
    "    print(f\"{key} fingerprint similarity: {sim:.3f}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "86bf16fe-5e1e-4ec0-ab5e-e752cf0ad4c7",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "RDKit313",
   "language": "python",
   "name": "rdkit313"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
